﻿using System;
using System.Collections.Generic;
using tour.szhome.common;
using tour.szhome.map.DTO;
using TOUR.SZHOME.DAL;
using TOUR.SZHOME.Entity;
namespace TOUR.SZHOME.BLL
{
    /// <summary>
    /// 数据表Projects_Image的业务逻辑类
    /// </summary>
    public class Projects_ImageBLL
    {
        /// <summary>
        /// 查询项目相册 -- 分页
        /// </summary>
        /// <param name="XMID">项目ID</param>
        /// <returns></returns>
        public List<AlbumDTO> GetList(int XMID)
        {
            return Projects_ImageDAL.GetAlbumList(XMID);
        }

        /// <summary>
        /// 根据项目ID获取相册详情列表
        /// </summary>
        /// <param name="XMID"></param>
        /// <returns></returns>
        public List<Projects_ImageEntity> GetListByXMID(int XMID)
        {
            return Projects_ImageDAL.GetByXMID(XMID);
        }

        /// <summary>
        /// 获取特定项目下某类型图片的相册
        /// </summary>
        /// <param name="XMID"></param>
        /// <returns></returns>
        public List<Projects_ImageEntity> GetList(int XMID, int type)
        {
            return Projects_ImageDAL.GetByIdAndType(XMID, type);
        }

        /// <summary>
        /// 编辑、新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Edit(Projects_ImageEntity model)
        {
            if (model.XCID > 0)
            {
                return Projects_ImageDAL.Update(model);
            }
            else
            {
                return Projects_ImageDAL.Insert(model);
            }
        }

        /// <summary>
        /// 根据ID删除对象
        /// </summary>
        /// <param name="pid"></param>
        /// <returns></returns>
        public bool DelByID(int pid)
        {
            return Projects_ImageDAL.Delete(pid);
        }
    }
}
